<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="user">
    <el-tree
      :data="menu"
      show-checkbox
      node-key="id"
      ref="tree"
      :props="defaultProps">
    </el-tree>
    <el-button @click="getCheckNode">通过Node获取</el-button>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        menu:[],
        defaultProps: {
          children: 'children',
          label: 'name'
        }
      }
    },
    methods:{
      getCheckNode(){
        console.log(this.$refs.tree.getCheckedNodes())
      }
    },
    created(){
      this.menu=[...this.$router.options.routes]
      console.log(...this.$router.options.routes)
    }
  }
</script>

<style lang="scss" scoped>

</style>